home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14168 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: reversing a string
  5. Date: Fri, 12 Apr 96 12:23:52 GMT
  6. Organization: none
  7. Message-ID: <829311832snz@genesis.demon.co.uk>
  8. References: <4k6cjl$j8f@central.server.swt.edu> <4kgh5g$1ue@eccdb1.pms.ford.com>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4kgh5g$1ue@eccdb1.pms.ford.com>
  15.            mbobak@pms991.uucp "Mark J. Bobak" writes:
  16.  
  17. >In article <4k6cjl$j8f@central.server.swt.edu>,
  18. >Leland Newsom <ln16674@nyssa.swt.edu> wrote:
  19. >>I have a challenge from a friend of mine.  He wanted me to reverse a string 
  20. >>with recursion without using any additional variables or loops.  I got mine
  21. >>to work by using exclusive or, but I needed an additional variable.  Can 
  22. >>someone help with this problem without using the additional variable?
  23. >>
  24. >>Thanks
  25. >
  26. >
  27. >Well, here's what I came up with....it seems to work.
  28. >
  29. >#include <stdio.h>
  30. >#include <string.h>
  31. >void revstr(char *string, int position)
  32.  
  33.                            ^^^^^^^^^^^^
  34.  
  35. The problem is that you are using an additional variable.
  36.  
  37. -- 
  38. -----------------------------------------
  39. Lawrence Kirby | fred@genesis.demon.co.uk
  40. Wilts, England | 70734.126@compuserve.com
  41. -----------------------------------------
  42.